package com.example.androiddemo.day713;

import android.app.Notification;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.widget.Toast;

import androidx.annotation.RequiresApi;

import com.example.androiddemo.R;

import static com.example.androiddemo.day713.BroadcastActivity.ChanelId;
import static com.example.androiddemo.day713.BroadcastActivity.manager;

public class BlueToothReceiver extends BroadcastReceiver {

    @RequiresApi(api = Build.VERSION_CODES.O)
    @Override
    public void onReceive(Context context, Intent intent) {
        Notification.Builder builder=new Notification.Builder(context,ChanelId)
                .setSmallIcon(R.drawable.ic_launcher_background)
                .setContentTitle("Blue State")
                .setContentText("你的蓝牙状态发生改变。");
        manager.notify(0x01,builder.build());

    }
}
